<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>康健因星创商城</title>
    <script src="__INDEX__/js/mui.min.js"></script>
	<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
	<link rel="stylesheet" href="__INDEX__/css/style.css" />
	<link rel="stylesheet" href="__INDEX__/css/mall.css?7=5" />	
</head>
<body>
	
	{if $Think.session.user_id}
	<nav class="mui-bar mui-bar-tab">
	    <a  href="{:url('index/index/hyty')}"><img src="__INDEX__/images/splb_btn.jpg"></a>
	</nav>
	{else/}
		<nav class="mui-bar mui-bar-tab">
	    <a  href="{:url('index/member/regist')}"><img src="__INDEX__/images/splb_btn.jpg"></a>
		</nav>
	{/if}
	<div class="mui-content cp_content" style="border-top: 1px #333333 solid;">
	    <!--<div class="searchbox clearfix">
	    	<div class="mui-input-row mui-search" onclick="search()" >
				<input type="search" id="searchname" class="mui-input-clear" placeholder="搜索商品名称">
			</div>
			<a href="#" class="btn_sous">取消</a>
	    </div>-->
	    {include file="public/top" /}
	    <div class="cp_lisbox">
	    	<div class="cp_bt"></div>
	    	<ul class="cp_list clearfix" style="margin-top: 5px;">
				{foreach name="list" item="g" key="k"}
				<li>
	    			<a href="/index/index/sp_page?goods_id={$g.id}">
	    				<div class="cpimg"><img src="{$g.thumb}"></div>
	    				<div class="cpname">{$g.goods_name}</div>
	    				<div class="cp_pribox">
	    				<span class="cp_pri">￥{$g.sale_price}</span>
	    				<span class="cp_btn"><img src="__INDEX__/images/icon.jpg"></span>
	    				</div>
	    			</a>
	    		</li>
	    		{if $k%2 neq 0}
	    		<li style="width: 100%;height:8px;background-color: #eee;"></li>
	    		{/if}
				{/foreach}
	    	</ul>
	    	<p id="no_record" style="color:#D6AA50;text-align: center;display: none;">数据已加载完毕</p>
	    </div>
	    
	    <div class="weixin" style="display: none;">
		    <img src="__INDEX__/images/wx-icon.png" width="40" height="40" />
		    <div class="xixi">
		        <img src="__INDEX__/images/erweima.jpg" width="150" height="150" />
		        <p>联系客服</p>
		    </div>
		</div>
	</div>
	<input type="hidden" id="page" value="1" />
</body>
{include file="public/footer" /}
<script type="text/javascript" src="__INDEX__/js/menudown.js" ></script>
</html>

<script>
	function search(){
		get_data();
	}
	$(".layui-layer-loading").css("top", "70%");
	//get_data();
	function get_data(){
			$.ajax({
			type:"post",
			data:{
				name:$("#searchname").val(),
				page:$("#page").val()
			},
			url:"{:url('index/index/index')}",
			success:function(data){	
				var list=data.list;
				var html="";
				if(list&&list.length>0){
					for(var i=0;i<list.length;i++){
						var log=list[i];
						html+='<li>'+
				    			'<a href="/index/index/sp_page?goods_id='+log.id+'">'+
				    				'<div class="cpimg"><img src="'+log.thumb+'"></div>'+
				    				'<div class="cpname">'+log.goods_name+'</div>'+
				    				'<div class="cp_pribox">'+
				    					'<span class="cp_pri">¥'+log.sale_price+'</span>'+
				    					'<span class="cp_btn"><img src="__INDEX__/images/icon.jpg"></span>'+
				    				'</div>'+
				    			'</a>'+
				    		'</li>';
					}
				}else{
					$("#no_record").show();
				}
				$(".cp_list").html(html);
				
			}
		});
	}
	$(window).scroll(function(){
		var scrollTop = $(window).scrollTop();       //滚动条高度
		var bodyheight = $(document).height();         //文档的高度
		var windowheight = window.innerHeight;	//$(window).height();              //当前窗体的高度
		if((bodyheight - windowheight - scrollTop) == 0){
			var index = layer.load(1, {
			  shade: [0.1,'#fff'], //0.1透明度的白色背景
			  time: 1.5 * 1000
			});
			return;
			$.ajax({
			type:"post",
			data:{
				page:parseFloat($("#page").val())+1
			},
			url:"{:url('index/index/index')}",
			success:function(data){	
				var list=data.list;
				var html="";
				if(list&&list.length>0){
					$("#page").val(parseFloat($("#page").val())+1);
					for(var i=0;i<list.length;i++){
						var log=list[i];
						html+='<li>'+
				    			'<a href="#">'+
				    				'<div class="cpimg"><img src="'+log.thumb+'"></div>'+
				    				'<div class="cpname">'+log.goods_name+'</div>'+
				    				'<div class="cp_pribox">'+
				    					'<span class="cp_pri">¥'+log.sale_price+'</span>'+
				    					'<span class="cp_btn"><img src="__INDEX__/images/icon.jpg"></span>'+
				    				'</div>'+
				    			'</a>'+
				    		'</li>';
					}
				}else{
					$("#no_record").show();
				}
				$(".cp_list").append(html);
				
			}
		});
		
		}				
	})
	
</script>